if ((new_io_pl > old_io_pl) && !capable(CAP_SYS_RAWIO))
return -EPERM;
- /* Maintain OS privileges even if user attempts to relinquish them. */
- if (new_io_pl == 0)
- new_io_pl = 1;
-
/* Change our version of the privilege levels. */
current->thread.io_pl = new_io_pl;
/* Force the change at ring 0. */
op.cmd = PHYSDEVOP_SET_IOPL;
- op.u.set_iopl.iopl = new_io_pl;
+ op.u.set_iopl.iopl = (new_io_pl == 0) ? 1 : new_io_pl;
HYPERVISOR_physdev_op(&op);
return 0;
if (unlikely(prev->io_pl != next->io_pl)) {
iopl_op.cmd = PHYSDEVOP_SET_IOPL;
- iopl_op.u.set_iopl.iopl = next->io_pl;
+ iopl_op.u.set_iopl.iopl = (next->io_pl == 0) ? 1 : next->io_pl;
mcl->op = __HYPERVISOR_physdev_op;
mcl->args[0] = (unsigned long)&iopl_op;
mcl++;
efi_map_memmap();
op.cmd = PHYSDEVOP_SET_IOPL;
- op.u.set_iopl.iopl = current->thread.io_pl = 1;
+ op.u.set_iopl.iopl = 1;
HYPERVISOR_physdev_op(&op);
#ifdef CONFIG_ACPI_BOOT
ctxt.user_regs.cs = __KERNEL_CS;
ctxt.user_regs.eip = start_eip;
ctxt.user_regs.esp = idle->thread.esp;
- ctxt.user_regs.eflags = (1<<9) | (1<<2) | (idle->thread.io_pl<<12);
+#define X86_EFLAGS_IOPL_RING1 0x1000
+ ctxt.user_regs.eflags = X86_EFLAGS_IF | X86_EFLAGS_IOPL_RING1;
/* FPU is set up to default initial state. */
memset(&ctxt.fpu_ctxt, 0, sizeof(ctxt.fpu_ctxt));
unsigned int old_io_pl = current->thread.io_pl;
physdev_op_t op;
-
if (new_io_pl > 3)
return -EINVAL;
if ((new_io_pl > old_io_pl) && !capable(CAP_SYS_RAWIO))
return -EPERM;
- /* Maintain OS privileges even if user attempts to relinquish them. */
- if (new_io_pl == 0)
- new_io_pl = 1;
-
/* Change our version of the privilege levels. */
current->thread.io_pl = new_io_pl;
/* Force the change at ring 0. */
op.cmd = PHYSDEVOP_SET_IOPL;
- op.u.set_iopl.iopl = new_io_pl;
+ op.u.set_iopl.iopl = (new_io_pl == 0) ? 1 : new_io_pl;
HYPERVISOR_physdev_op(&op);
return 0;
if (unlikely(prev->io_pl != next->io_pl)) {
iopl_op.cmd = PHYSDEVOP_SET_IOPL;
- iopl_op.u.set_iopl.iopl = next->io_pl;
+ iopl_op.u.set_iopl.iopl = (next->io_pl == 0) ? 1 : next->io_pl;
mcl->op = __HYPERVISOR_physdev_op;
mcl->args[0] = (unsigned long)&iopl_op;
mcl++;
#endif
op.cmd = PHYSDEVOP_SET_IOPL;
- op.u.set_iopl.iopl = current->thread.io_pl = 1;
+ op.u.set_iopl.iopl = 1;
HYPERVISOR_physdev_op(&op);
if (xen_start_info.flags & SIF_INITDOMAIN) {